---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: d8-vertical-pod-autoscaler-admission-controller
  namespace: kube-system
  {{- include "helm_lib_module_labels" (list . (dict "app" "vpa-admission-controller")) | nindent 2 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: d8:vertical-pod-autoscaler:admission-controller
  {{- include "helm_lib_module_labels" (list .) | nindent 2 }}
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - configmaps
  - nodes
  - limitranges
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - "admissionregistration.k8s.io"
  resources:
  - mutatingwebhookconfigurations
  verbs:
  - create
  - delete
  - get
  - list
- apiGroups:
  - "poc.autoscaling.k8s.io"
  resources:
  - verticalpodautoscalers
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - "autoscaling.k8s.io"
  resources:
  - verticalpodautoscalers
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - "coordination.k8s.io"
  resources:
  - leases
  verbs:
  - create
  - update
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: d8:vertical-pod-autoscaler:admission-controller
  {{- include "helm_lib_module_labels" (list .) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:vertical-pod-autoscaler:admission-controller
subjects:
- kind: ServiceAccount
  name: d8-vertical-pod-autoscaler-admission-controller
  namespace: kube-system
